import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {HomeComponent} from './home/home.component';
import {WelcomeComponent} from './welcome/welcome.component';
import {LoginComponent} from './login/login.component';
import {CourseSelectComponent} from './course-select/course-select.component';
import {CourseComponent} from './course/course.component';
import {CourseDetailComponent} from './course-detail/course-detail.component';
import {StudentComponent} from './student/student.component';
import {StudentDetailComponent} from './student-detail/student-detail.component';
import {StudentgradeComponent} from './studentgrade/studentgrade.component';
import {StudentsgradeComponent} from './studentsgrade/studentsgrade.component';
import {HometowmComponent} from './hometowm/hometowm.component';
import {AgeTableComponent} from './age-table/age-table.component';
import {PanelComponent} from './panel/panel.component';
import {GPAMajorComponent} from './gpa-major/gpa-major.component';
import {CourseGPAComponent} from './course-gpa/course-gpa.component';
import {PageComponent} from './page/page.component';
import {SearchComponent} from './search/search.component';
import {SelectCourseComponent} from './select-course/select-course.component';
import {SnoSearchComponent} from './sno-search/sno-search.component';
import {SnoGradeComponent} from './sno-grade/sno-grade.component';
import {SearchCourseComponent} from './search-course/search-course.component';
import {CourseStudentComponent} from './course-student/course-student.component';



const routes: Routes = [
  {path: '', redirectTo: '/welcome', pathMatch: 'full'},
  {path: 'welcome', component: WelcomeComponent},
  {path: 'home', component: HomeComponent,
  children: [
    {path: 'CourseStudent', component: CourseStudentComponent,
      children: [
        {path: ':courseid', component: SelectCourseComponent}
      ] },
    {path: 'searchCourse', component: SearchCourseComponent,
      children: [
        {path: ':courseid', component: CourseDetailComponent}
      ] },
    {path: 'SnoGrade', component: SnoGradeComponent,
      children:
        [{path: ':stuid', component: StudentgradeComponent}]},
    {path: 'SnoSearch', component: SnoSearchComponent,
      children:
        [{path: ':stuid', component: SearchComponent,
        children: [
          {path: '', component: StudentDetailComponent},
          {path: 'grade/:stuid', component: StudentgradeComponent}
        ]}
        ]},
    {path: 'student', component: SearchComponent,
      children: [
        {path: '', component: StudentComponent},
        {path: 'detail/:stuid', component: SearchComponent,
          children: [
            {path: '', component: StudentDetailComponent},
            {path: 'grade/:stuid', component: StudentgradeComponent}
          ]},
        ]},
    {path: '', component: PageComponent},
    {path: 'panel', component: PanelComponent},
    {path: 'courseInfo', component: SearchComponent,
      children: [
        {path: '', component: CourseComponent},
        {path: 'detailCourse/:courseid', component: CourseDetailComponent}
      ]},
    {path: 'courseSelect', component: SearchComponent,
    children: [
      {path: '', component: CourseSelectComponent},
      {path: ':courseid', component: CourseDetailComponent},
      {path: 'detail/:stuid', component: SearchComponent,
        children: [
          {path: '', component: StudentDetailComponent},
          {path: 'grade/:stuid', component: StudentgradeComponent}
        ]},
    ]},
    {path: 'grade', component: StudentsgradeComponent},
    {path: 'hometown', component: HometowmComponent},
    {path: 'ageTable', component: AgeTableComponent},
    {path: 'gpa', component: GPAMajorComponent},
    {path: 'coursegpa', component: SearchComponent,
    children: [
      {path: '', component: CourseGPAComponent},
      {path: ':courseid', component: SelectCourseComponent}
    ]},
    ]},
  ];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
